/**
 * 封装通用的cell，一般用于我的界面和设置界面
 * ----------------
 * | icon text   > |
 * ----------------
 */
'use strict';
import React, { PropTypes } from 'react';
import {
    View,
    Text,
    TouchableOpacity,
    Image,
    StyleSheet,
} from 'react-native';

const TableRow = ({ onPress, title, icon }) => (
  <TouchableOpacity style = { styles.wrap_style }
    onPress = { onPress } >
    <View style = { { flexDirection: 'row' } } >
      <View style = { styles.item_view } >
        <Image style = { styles.item_img } source = { icon } />
      </View>
      <View style = { styles.item_view } >
        <Text style = { { marginLeft: 8 } } > { title } </Text>
      </View>
      <View style = { styles.item_arrow_view } >
        <Image source = { require('../../resources/images/mine/icon_s_right_arrow.png') } style = { { width: 17, height: 17 } }/>
      </View>
    </View>
  </TouchableOpacity>
);

const styles = StyleSheet.create({
    wrap_style: {
        height: 46,
        backgroundColor: 'white',
    },
    item_view: {
        height: 46,
        justifyContent: 'center',
    },
    item_img: {
        width: 23,
        height: 23,
        marginLeft: 17,
    },
    item_arrow_view: {
        height: 46,
        justifyContent: 'center',
        flex: 1,
        alignItems: 'flex-end',
        marginRight: 17
    }
});
export default TableRow;
